﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

using _XNA__RunningDeath.GLO;

namespace _XNA__RunningDeath.BUS
{
    class BUS
    {
        int speedVT = 0;
        int dem1 = 0;
        int dem2 = 0;

        public void UpDate(GameTime gameTime) 
        {
            if (CGLOBAL.NewGame == enumGame.mLoad)
            {
                speedVT = CGLOBAL.speedAt;
            }
            else
            {
                speedVT = CGLOBAL.speedDa;
            }

            if (CGLOBAL.Score > 1 && CGLOBAL.Score % CThamSo.limitScore == 0 && dem1 == 0)
            {
                speedVT = speedVT + 1;
                dem1++;
            }
            if (CGLOBAL.Score % CThamSo.limitScore != 0)
            {
                dem1 = 0;
            }

            if (CGLOBAL.Score > 1 && CGLOBAL.Score % CThamSo.limitScoreAdd == 0 && dem2 == 0)
            {
                 CGLOBAL.Life += 1;
                dem2++;
            }
            if(CGLOBAL.Score % CThamSo.limitScoreAdd != 0)
            {
                dem2 = 0;
            }


           CGLOBAL.speedAt = CGLOBAL.speedDa = CGLOBAL.speedBeMatDiChuyen = CGLOBAL.speedChuoi = speedVT;
        }
    }
}
